
//获取办理意见
function GetDF_Opinion(InstanceID){
	//var InstanceID = 'GZ202013001/9-4-001';
	Ext.getBody().mask("数据加载中,请稍等！");
	Ext.Ajax.request({
	  	url: '${ctx}/process-instance!GetDF_Opinion.action',
	  	success:GetDF_OpinionResultHandler,
	  	failure:faultHandler,
		params: {			
	     	InstanceID:InstanceID
	   	}
	});	
}

//获取办理意见  成功
function GetDF_OpinionResultHandler(result){
	var resultObj = result.responseText;
	var myobj=eval(resultObj);
	var html='<center><table width="700" border="0" cellspacing="2" cellpadding="2">';
    html+='<tr><td><table width="100%" border="0" cellspacing="2" cellpadding="2">';
    html+='<tr><td height="55" bordercolor="#000000" align="center" style="font-size:22px;">';
    html+='<br /><b>办理意见</b><br /><br/></td></tr></table></td></tr>';
    html+='<tr><td><table width="100%" border="1" cellspacing="0" cellpadding="2" class="tpl_list_ui">';
    for(var i=0;i<myobj.length;i++){
    	html+='<tr>';   
	    html+='<td width="20%" colspan="1" bordercolor="#000000" rowspan="4" height="25" align="center">'+myobj[i].DeptName+'</td>';
	    html+='<td width="20%" align="center" colspan="1" bordercolor="#000000" height="25" style="padding: 1px 1px 1px 1px;">办理人姓名</td>';
	    html+='<td width="60%" colspan="3" bordercolor="#000000" height="25" style="padding: 1px 1px 1px 1px;">'+myobj[i].PersonName+'</td>'; 
	    html+='</tr>';
	    html+='<tr>';
	    html+='<td width="20%" align="center" colspan="1" bordercolor="#000000" height="25" style="padding: 1px 1px 1px 1px;">意见结果</td>';
	    html+='<td width="60%" colspan="3" bordercolor="#000000" height="25" style="padding: 1px 1px 1px 1px;">'+myobj[i].OpinionResult+'</td>'; 
	    html+='</tr>';
	    html+='<tr>';
	    html+='<td width="20%" align="center" colspan="1" bordercolor="#000000" height="25" style="padding: 1px 1px 1px 1px;">意见详细</td>';
	    html+='<td width="60%" colspan="3" bordercolor="#000000" height="25" style="padding: 1px 1px 1px 1px;"><textarea style="width:100%" rows="5" readOnly>'+myobj[i].OpinionDetail+'</textarea></td>'; 
	    html+='</tr>';
	    html+='<tr>';
	    html+='<td width="20%" align="center" colspan="1" bordercolor="#000000" height="25" style="padding: 1px 1px 1px 1px;">发布时间</td>';
	    html+='<td width="60%" colspan="3" bordercolor="#000000" height="25" style="padding: 1px 1px 1px 1px;">'+myobj[i].OpinionTime+'</td>'; 
	    html+='</tr>';
    }    
    
    html+='</table></td></tr></table>';
	document.getElementById("tpanel15").innerHTML=html;
	Ext.getBody().unmask();
}

//办理进度公开接口
function GetProjectStep(InstanceID){
	//var InstanceID = 'GZ2020130019-4-001';
	Ext.getBody().mask("数据加载中,请稍等！");
	Ext.Ajax.request({
	  	url: '${ctx}/process-instance!GetProjectStep.action',
	  	success:GetProjectStepResultHandler,
	  	failure:faultHandler,
		params: {			
	     	InstanceID:InstanceID
	   	}
	});	
}

//办理进度公开接口  成功
function GetProjectStepResultHandler(result){
	var resultObj = result.responseText;
	var myobj=eval(resultObj);
	var html='<center><table width="700" border="0" cellspacing="2" cellpadding="2">';
    html+='<tr><td><table width="100%" border="0" cellspacing="2" cellpadding="2">';
    html+='<tr><td height="55" bordercolor="#000000" align="center" style="font-size:22px;">';
    html+='<br /><b>办理进度</b><br /><br/></td></tr></table></td></tr>';
    html+='<tr><td><table width="100%" border="1" cellspacing="0" cellpadding="2" class="tpl_list_ui">';
    html+='<tr>';   
    html+='<td width="20%" bordercolor="#000000" colspan="2" height="25" align="center">阶段实例ID</td>';
    html+='<td width="80%" colspan="3" bordercolor="#000000" style="padding: 1px 1px 1px 1px;">'+myobj[0].DF_instanceID+'</td>';   
    html+='</tr>';
    html+='<tr>';   
    html+='<td width="20%" bordercolor="#000000" colspan="2" height="25" align="center">阶段ID</td>';
    html+='<td width="80%" colspan="3" bordercolor="#000000" style="padding: 1px 1px 1px 1px;">'+myobj[0].DF_ID+'</td>';   
    html+='</tr>';
    html+='<tr>';   
    html+='<td width="20%" bordercolor="#000000" colspan="2" height="25" align="center">阶段名称</td>';
    html+='<td width="80%" colspan="3" bordercolor="#000000" style="padding: 1px 1px 1px 1px;">'+myobj[0].DF_Name+'</td>';   
    html+='</tr>';
    html+='<tr>';   
    html+='<td bordercolor="#000000" colspan="2" height="25" align="center">牵头部门名称</td>';
    html+='<td colspan="3" bordercolor="#000000" style="padding: 1px 1px 1px 1px;">'+myobj[0].LeaderDeptName+'</td>';   
    html+='</tr>';
    html+='<tr>';   
    html+='<td bordercolor="#000000" colspan="2" height="25" align="center">牵头部门ID</td>';
    html+='<td colspan="3" bordercolor="#000000" style="padding: 1px 1px 1px 1px;">'+myobj[0].LeaderDeptId+'</td>';   
    html+='</tr>';
    html+='<tr>';   
    html+='<td bordercolor="#000000" colspan="2" height="25" align="center">工程编号</td>';
    html+='<td colspan="3" bordercolor="#000000" style="padding: 1px 1px 1px 1px;">'+myobj[0].ProjectId+'</td>';   
    html+='</tr>';
    html+='<tr>';   
    html+='<td bordercolor="#000000" colspan="2" height="25" align="center">工程名称</td>';
    html+='<td colspan="3" bordercolor="#000000" style="padding: 1px 1px 1px 1px;">'+myobj[0].ProjectName+'</td>';   
    html+='</tr>';
    html+='<tr>';   
    html+='<td bordercolor="#000000" colspan="2" height="25" align="center">申报单位ID</td>';
    html+='<td colspan="3" bordercolor="#000000" style="padding: 1px 1px 1px 1px;">'+myobj[0].ApplyDeptId+'</td>';   
    html+='</tr>';
    html+='<tr>';   
    html+='<td bordercolor="#000000" colspan="2" height="25" align="center">申报单位名称</td>';
    html+='<td colspan="3" bordercolor="#000000" style="padding: 1px 1px 1px 1px;">'+myobj[0].ApplyDeptName+'</td>';   
    html+='</tr>';
    html+='<tr>';   
    html+='<td bordercolor="#000000" colspan="2" height="25" align="center">申报时间</td>';
    html+='<td colspan="3" bordercolor="#000000" style="padding: 1px 1px 1px 1px;">'+myobj[0].ApplyTime+'</td>';   
    html+='</tr>';
    html+='<tr>';   
    html+='<td bordercolor="#000000" colspan="2" height="25" align="center">开始时间</td>';
    html+='<td colspan="3" bordercolor="#000000" style="padding: 1px 1px 1px 1px;">'+myobj[0].StartTime+'</td>';   
    html+='</tr>';
    html+='<tr>';   
    html+='<td bordercolor="#000000" colspan="2" height="25" align="center">结束时间</td>';
    html+='<td colspan="3" bordercolor="#000000" style="padding: 1px 1px 1px 1px;">'+myobj[0].FinishTime+'</td>';   
    html+='</tr>';
    html+='<tr>';   
    html+='<td bordercolor="#000000" colspan="2" height="25" align="center">当前步骤</td>';
    html+='<td colspan="3" bordercolor="#000000" style="padding: 1px 1px 1px 1px;">'+myobj[0].CurStepId+'</td>';   
    html+='</tr>';
    html+='<tr>';   
    html+='<td bordercolor="#000000" colspan="2" height="25" align="center">总步骤</td>';
    html+='<td colspan="3" bordercolor="#000000" style="padding: 1px 1px 1px 1px;">'+myobj[0].TotalStepCount+'</td>';   
    html+='</tr>';
    
    html+='</table></td></tr></table>';
	document.getElementById("tpanel16").innerHTML=html;
	Ext.getBody().unmask();
}

//工程信息共享接口
function GetProjectForm(InstanceID){
	//var InstanceID = 'GZ2020130019-4-001';
	Ext.getBody().mask("数据加载中,请稍等！");
	Ext.Ajax.request({
	  	url: '${ctx}/process-instance!GetProjectForm.action',
	  	success:GetProjectFormResultHandler,
	  	failure:faultHandler,
		params: {			
	     	InstanceID:InstanceID
	   	}
	});
}

//工程信息共享接口  成功
function GetProjectFormResultHandler(result){
	var resultObj = result.responseText;
	var myobj=eval(resultObj);
	var html='<center><table width="700" border="0" cellspacing="2" cellpadding="2">';
    html+='<tr><td><table width="100%" border="0" cellspacing="2" cellpadding="2">';
    html+='<tr><td height="55" bordercolor="#000000" align="center" style="font-size:22px;">';
    html+='<br /><b>申请单位（人）信息</b><br /><br/></td></tr></table></td></tr>';
    html+='<tr><td><table width="100%" border="1" cellspacing="0" cellpadding="2" class="tpl_list_ui">';
    html+='<tr>';   
    html+='<td width="20%" bordercolor="#000000" colspan="2" height="25" align="center">申请单位（人）</td>';
    html+='<td width="30%" colspan="3" bordercolor="#000000" style="padding: 1px 1px 1px 1px;">'+myobj[0].ShenQingDanWeiR+'</td>';
    html+='<td width="20%" bordercolor="#000000" colspan="2" height="25" align="center">单位电话</td>';
    html+='<td width="30%" colspan="3" bordercolor="#000000" style="padding: 1px 1px 1px 1px;">'+myobj[0].Pro_CompanyPhone+'</td>';
    html+='</tr>';
    html+='<tr>';   
    html+='<td width="20%" bordercolor="#000000" colspan="2" height="25" align="center">邮编</td>';
    html+='<td width="30%" colspan="3" bordercolor="#000000" style="padding: 1px 1px 1px 1px;">'+myobj[0].YouBian+'</td>';
    html+='<td width="20%" bordercolor="#000000" colspan="2" height="25" align="center">电子邮箱</td>';
    html+='<td width="30%" colspan="3" bordercolor="#000000" style="padding: 1px 1px 1px 1px;">'+myobj[0].DianZiYouXiang+'</td>';
    html+='</tr>';
    html+='<tr>';   
    html+='<td width="20%" bordercolor="#000000" colspan="2" height="25" align="center">组织机构代码</td>';
    html+='<td width="30%" colspan="3" bordercolor="#000000" style="padding: 1px 1px 1px 1px;">'+myobj[0].ZuZhiJiGouDM+'</td>';
    html+='<td width="20%" bordercolor="#000000" colspan="2" height="25" align="center">企业类型</td>';
    html+='<td width="30%" colspan="3" bordercolor="#000000" style="padding: 1px 1px 1px 1px;">'+myobj[0].QiYeLeiXing+'</td>';
    html+='</tr>';
    html+='<tr>';   
    html+='<td width="20%" bordercolor="#000000" colspan="2" height="25" align="center">法人代表</td>';
    html+='<td width="30%" colspan="3" bordercolor="#000000" style="padding: 1px 1px 1px 1px;">'+myobj[0].FaRenDaiBiao+'</td>';
    html+='<td width="20%" bordercolor="#000000" colspan="2" height="25" align="center">注册资金：（万元）</td>';
    html+='<td width="30%" colspan="3" bordercolor="#000000" style="padding: 1px 1px 1px 1px;">'+myobj[0].ZhuCeZiJin+'</td>';
    html+='</tr>';
    html+='<tr>';   
    html+='<td width="20%" bordercolor="#000000" colspan="2" height="25" align="center">联系人姓名</td>';
    html+='<td width="30%" colspan="3" bordercolor="#000000" style="padding: 1px 1px 1px 1px;">'+myobj[0].Pro_ContactName+'</td>';
    html+='<td width="20%" bordercolor="#000000" colspan="2" height="25" align="center">联系人身份证号</td>';
    html+='<td width="30%" colspan="3" bordercolor="#000000" style="padding: 1px 1px 1px 1px;">'+myobj[0].LianXiRenShenFZH+'</td>';
    html+='</tr>';
    html+='<tr>';   
    html+='<td width="20%" bordercolor="#000000" colspan="2" height="25" align="center">联系人手机</td>';
    html+='<td width="30%" colspan="3" bordercolor="#000000" style="padding: 1px 1px 1px 1px;">'+myobj[0].Pro_ContactPhone+'</td>';
    html+='<td width="20%" bordercolor="#000000" colspan="2" height="25" align="center">联系人电话</td>';
    html+='<td width="30%" colspan="3" bordercolor="#000000" style="padding: 1px 1px 1px 1px;">'+myobj[0].LianXiRenDianH+'</td>';
    html+='</tr>';    
    html+='</table></td></tr></table>';
    
    html+='<center><table width="700" border="0" cellspacing="2" cellpadding="2">';
    html+='<tr><td><table width="100%" border="0" cellspacing="2" cellpadding="2">';
    html+='<tr><td height="55" bordercolor="#000000" align="center" style="font-size:22px;">';
    html+='<br /><b>项目基本信息</b><br /><br/></td></tr></table></td></tr>';
    html+='<tr><td><table width="100%" border="1" cellspacing="0" cellpadding="2" class="tpl_list_ui">';
    html+='<tr>';   
    html+='<td width="20%" bordercolor="#000000" colspan="2" height="25" align="center">项目名称</td>';
    html+='<td width="80%" colspan="8" bordercolor="#000000" style="padding: 1px 1px 1px 1px;">'+myobj[0].Pro_ProjectName+'</td>';
    html+='</tr>';
    html+='<tr>';   
    html+='<td width="20%" bordercolor="#000000" colspan="2" height="25" align="center">项目地址</td>';
    html+='<td width="80%" colspan="8" bordercolor="#000000" style="padding: 1px 1px 1px 1px;">'+myobj[0].Pro_ConstructionUnitAddress+'</td>';
    html+='</tr>';
    html+='<tr>';   
    html+='<td width="20%" bordercolor="#000000" colspan="2" height="25" align="center">项目建设单位</td>';
    html+='<td width="80%" colspan="8" bordercolor="#000000" style="padding: 1px 1px 1px 1px;">'+myobj[0].Pro_ConstructionUnit+'</td>';
    html+='</tr>';
    html+='<tr>';   
    html+='<td width="20%" bordercolor="#000000" colspan="2" height="25" align="center">总投资：（万元）</td>';
    html+='<td width="80%" colspan="8" bordercolor="#000000" style="padding: 1px 1px 1px 1px;">'+myobj[0].Pro_TotalInvestment+'</td>';
    html+='</tr>';
    html+='<tr>';   
    html+='<td width="20%" bordercolor="#000000" colspan="2" height="25" align="center">项目内容及规模</td>';
    html+='<td width="80%" colspan="8" bordercolor="#000000" style="padding: 1px 1px 1px 1px;">'+myobj[0].XiangMuNeiRongJGM+'</td>';
    html+='</tr>';
    html+='<tr>';   
    html+='<td width="20%" bordercolor="#000000" colspan="2" height="25" align="center">项目目的</td>';
    html+='<td width="80%" colspan="8" bordercolor="#000000" style="padding: 1px 1px 1px 1px;">'+myobj[0].XiangMuMuDe+'</td>';
    html+='</tr>';
    html+='<tr>';   
    html+='<td width="20%" bordercolor="#000000" colspan="2" height="25" align="center">（计划）开工时间</td>';
    html+='<td width="30%" colspan="3" bordercolor="#000000" style="padding: 1px 1px 1px 1px;">'+myobj[0].KaiGongShiJian+'</td>';
    html+='<td width="20%" bordercolor="#000000" colspan="2" height="25" align="center">（计划）结束时间</td>';
    html+='<td width="30%" colspan="3" bordercolor="#000000" style="padding: 1px 1px 1px 1px;">'+myobj[0].JieShuShiJian+'</td>';
    html+='</tr>';   
    html+='<tr>';   
    html+='<td width="20%" bordercolor="#000000" colspan="2" height="25" align="center">备注</td>';
    html+='<td width="80%" colspan="8" bordercolor="#000000" style="padding: 1px 1px 1px 1px;">'+myobj[0].BeiZhu+'</td>';
    html+='</tr>';
    html+='</table></td></tr></table>';
	document.getElementById("tpanel17").innerHTML=html;
	//设置隐藏值
	if(document.getElementById("ShenQingDanWeiR")){
		document.getElementById("ShenQingDanWeiR").value = myobj[0].ShenQingDanWeiR;
	}
	if(document.getElementById("ProContactName")){
		document.getElementById("ProContactName").value = myobj[0].Pro_ContactName;
	}
	if(document.getElementById("ProContactPhone")){
		document.getElementById("ProContactPhone").value = myobj[0].Pro_ContactPhone;
	}
	if(document.getElementById("ProProjectName")){
		document.getElementById("ProProjectName").value = myobj[0].Pro_ProjectName;
	}
	if(document.getElementById("ProConstructionUnitAddress")){
		document.getElementById("ProConstructionUnitAddress").value = myobj[0].Pro_ConstructionUnitAddress;
	}	
	Ext.getBody().unmask();
}

//获取申请材料
function GetResourcesObjectInfo(InstanceID){
	//var InstanceID = 'GZ2020130019-4-001';
	Ext.getBody().mask("数据加载中,请稍等！");
	Ext.Ajax.request({
	  	url: '${ctx}/process-instance!GetResourcesObjectInfo.action',
	  	success:GetResourcesObjectInfoResultHandler,
	  	failure:faultHandler,
		params: {			
	     	InstanceID:InstanceID
	   	}
	});	
}

//获取申请材料  成功
function GetResourcesObjectInfoResultHandler(result){
	var resultObj = result.responseText;
	var myobj=eval(resultObj);
	var html='';
	var DianZStr = '';
    var ZhiZStr = '';
    var ZhengZStr = '';
    for(var i=0;i<myobj.length;i++){
    	if(i == 0){//电子材料
    		html+='<center><table width="700" border="0" cellspacing="2" cellpadding="2">';
		    html+='<tr><td><table width="100%" border="0" cellspacing="2" cellpadding="2">';
		    html+='<tr><td height="55" bordercolor="#000000" align="center" style="font-size:22px;">';
		    html+='<br /><b>电子材料</b><br /><br/></td></tr></table></td></tr>';
		    html+='<tr><td><table width="100%" border="1" cellspacing="0" cellpadding="2" class="tpl_list_ui">';
		}else if(i == 1){//纸质材料
			html+='<center><table width="700" border="0" cellspacing="2" cellpadding="2">';
		    html+='<tr><td><table width="100%" border="0" cellspacing="2" cellpadding="2">';
		    html+='<tr><td height="55" bordercolor="#000000" align="center" style="font-size:22px;">';
		    html+='<br /><b>纸质材料</b><br /><br/></td></tr></table></td></tr>';
		    html+='<tr><td><table width="100%" border="1" cellspacing="0" cellpadding="2" class="tpl_list_ui">';
		}else if(i == 2){//证照材料
			html+='<center><table width="700" border="0" cellspacing="2" cellpadding="2">';
		    html+='<tr><td><table width="100%" border="0" cellspacing="2" cellpadding="2">';
		    html+='<tr><td height="55" bordercolor="#000000" align="center" style="font-size:22px;">';
		    html+='<br /><b>证照材料</b><br /><br/></td></tr></table></td></tr>';
		    html+='<tr><td><table width="100%" border="1" cellspacing="0" cellpadding="2" class="tpl_list_ui">';
		}
    	var obj = eval(myobj[i]);
		html+='<tr>';   
	    html+='<td align="center" bordercolor="#000000" colspan="1" height="25" align="center">序号</td>';
	    html+='<td align="center" colspan="3" bordercolor="#000000" style="padding: 1px 1px 1px 1px;">材料名</td>';
	    html+='<td align="center" colspan="3" bordercolor="#000000" style="padding: 1px 1px 1px 1px;">附件</td>';
	    html+='</tr>';
	    
    	for(var j=0;j<obj.length;j++){
    		if(i == 0){//电子材料
    			if(DianZStr.indexOf(obj[j].FileName) < 0){
    				DianZStr+=obj[j].FileName + '+++';
    			}
    			html+='<tr>';   
			    html+='<td width="10%" bordercolor="#000000" colspan="1" height="25" align="center">'+(j+1)+'</td>';
			    html+='<td width="45%" colspan="3" bordercolor="#000000" style="padding: 1px 1px 1px 1px;">'+obj[j].FileName+'</td>';
			    html+='<td width="45%" colspan="3" bordercolor="#000000" style="padding: 1px 1px 1px 1px;">[电子]<a href="'+obj[0].ResourcePath+'" target="blank">[预览]</a>'+obj[j].ResourceName+'</td>';
			    html+='</tr>';
    		}else if(i == 1){//纸质材料
    			html+='<tr>';   
			    html+='<td width="10%" bordercolor="#000000" colspan="1" height="25" align="center">'+(j+1)+'</td>';
			    html+='<td width="45%" colspan="3" bordercolor="#000000" style="padding: 1px 1px 1px 1px;">'+obj[j].FileName+'</td>';
			    html+='<td width="45%" colspan="3" bordercolor="#000000" style="padding: 1px 1px 1px 1px;">[纸质材料]材料名称：'+obj[j].ResourceName+'</td>';
			    html+='</tr>';
    		}else if(i == 2){//证照材料
    			html+='<tr>';   
			    html+='<td width="10%" bordercolor="#000000" colspan="1" height="25" align="center">'+(j+1)+'</td>';
			    html+='<td width="45%" colspan="3" bordercolor="#000000" style="padding: 1px 1px 1px 1px;">'+obj[j].FileName+'</td>';
			    html+='<td width="45%" colspan="3" bordercolor="#000000" style="padding: 1px 1px 1px 1px;">[证照材料]证照编号：'+obj[j].RCode+'</td>';
			    html+='</tr>';
    		}
    		
    	}
    }
    html+='</table></td></tr></table>';
	document.getElementById("tpanel14").innerHTML=html;
	Ext.getBody().unmask();
}

function faultHandler(){
	Ext.getBody().unmask();
    alert("获取数据失败!");
}